package service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import dao.AdminMapper;
import entity.Admin;
import entity.AdminExample;
import entity.AdminExample.Criteria;

@Service
public class AdmainServiceImpl implements AdminService {
	
	@Autowired
	 AdminMapper adminMapper;

	@Override
	public List<Admin> selectName(String supername){
		AdminExample example=new AdminExample();
		Criteria criteria = example.createCriteria();
		System.out.println(criteria);
		//where name=?
		criteria.andSupernameEqualTo(supername);
		List<Admin> list=adminMapper.selectByExample(example);
		return list;
	}

	@Override
	public Admin findId(Integer superid) {
		
		return adminMapper.selectByPrimaryKey(superid);
	}

	@Override
	public void update(Admin admin) {
		 adminMapper.updateByPrimaryKey(admin);
		
	}

	@Override
	public void delete(Integer superid) {
		adminMapper.deleteByPrimaryKey(superid);
		
	}

	@Override
	public void insert(Admin admin) {
		adminMapper.insert(admin);
		
	}

	@Override
	public List<Admin> queryAll() {
		return adminMapper.selectByExample(new AdminExample());
	}

	



}
